package com.bw.contorller;

import com.bw.bean.Mover;
import com.bw.bean.Mover1;
import com.bw.bean.Mover2;
import com.bw.bean.Mover3;
import com.bw.service.KcService;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;

@RestController
public class KcController {
    @Autowired
    KcService kcService;

    @RequestMapping("list1")
    public Map getList1(){
        List list = new ArrayList<>();
        list.add("姓名");
        list.add("下单金额");
        list.add("下单次数");
        list.add("下单人数");
        list.add("实收金额");
        list.add("退款成功金额");
        List<Mover> list1 = kcService.getList1();
        return SugarUtil.getTablePlayData(list,list1);
    }

    @RequestMapping("list2")
    public Map getList2(){
        List list = new ArrayList<>();
        list.add("统计日期");
        list.add("最近天数");
        list.add("直营店优惠分摊支出金额");
        list.add("加盟店优惠分摊支出金额");
        list.add("总支出");
        List<Mover1> list2= kcService.getList2();
        return SugarUtil.getTablePlayData(list,list2);
    }

    @RequestMapping("list3")
    public Map getList3(){
        List<Mover2> list3 = kcService.getList3();
        return SugarUtil.getBarData(list3);
    }

    @RequestMapping("list4")
    public Map getList4(){
        List<Mover3> list4 = kcService.getList4();
        return SugarUtil.getLineData(list4);
    }
}
